# Ղ̌
# ============================================================================
#	{[iXXe[WRiKEZ`j
# ============================================================================
include	/sys/sys.mak
include	/sys/tmp.mak
TARGET	=	bns3
# ============================================================================
#	Ώۃt@C
# ============================================================================
include	files.mak
include	data.mak
include	music.mak
# ============================================================================
#	ŏI^[Qbg
# ============================================================================
all:	prog.bin data.bin
	copy /b prog.bin+data.bin ${TARGET}.bin
	sizechk 32 ${TARGET}.bin
	sumwrite ${TARGET}.bin
	${expand ${HDW} -U${PROGSIZE},$${CDPOS_${TARGET}} ${TARGET}.bin ${PROGNAME}}
	${expand ${cdlen}}
	del ${TARGET}.bin

prog.bin:	data.ext music.ext ${FILES} ${MUSIC} linkfile
	lk -b$@ -m${TARGET}.map -s${TARGET}.sym @linkfile

clean:
	${cmdsplit -rm %,60,${FILES}}
	-rm ${TARGET}.bin

linkfile:	lnkseg.sed ${TARGET}.lnk files.mak music.mak
	sed -f lnkseg.sed ${TARGET}.lnk>$0
	techo -i $0
	${cmdsplit techo %,60,${FILES}}
	${cmdsplit techo %,60,${MUSIC}}
	techo -o $@

data.o:	data.equ data.pub

data.ext:	data.equ
	sed -n s/^\([A-Za-z_][0-9A-Za-z_]*\).*/\textrn\t\1/p $^>$@
data.pub:	data.equ
	sed -n s/^\([A-Za-z_][0-9A-Za-z_]*\).*/\tpublic\t\1/p $^>$@
# -------
music.o:	music.equ music.pub
#
music.ext:	music.equ
	sed -n s/^\([A-Za-z_][0-9A-Za-z_]*\).*/\textrn\t\1/p $^>$@
#
music.pub:	music.equ
	sed -n s/^\([A-Za-z_][0-9A-Za-z_]*\).*/\tpublic\t\1/p $^>$@


#
# ̈ʊ֌ẂABAdata.ext ͂łȂƍ̂
# ${TARGET}.bin ̃\[Xɂׂ
#
#${FILES}:	data.ext music.ext
# ============================================================================
#	f[^
# ============================================================================
data.bin data.equ:	${DATA} datalist
	blib datalist data.bin data.equ

datalist:	data.mak
	techo -z
	${cmdsplit techo %,60,${DATA}}
	techo -o $@
# ============================================================================
#	yf[^
# ============================================================================
music.s music.equ:	musiclst
	jgawk -f ${GAME}\music.awk $^

musiclst:	music.mak
	techo -z
	${cmdsplit techo %,60,${MUSIC}}
	techo -o $@
# ----------------------------------------------------------------------------
#	defseg.h  linkfile ̃ZOgAhXݒ肷
#	rdcXNvg𐶐B
# ----------------------------------------------------------------------------
lnkseg.sed:	${GAME}\lnkseg.awk defseg.h
	jgawk -f $^ >$@
# -----------------------------------------------------------------------------
include	/game/game.mak

# -----------------------------------------------------------------------------
stgwork.o:	stgwork.pub stgwork.ext

stgwork.pub stgwork.ext:	stgwork.awk stgwork.s
	jgawk -f $^

# -----------------------------------------------------------------------------
status.o:	${BTD}\time.btd	\pic\stg\alfnum.tbl \pic\stg\gage2.fnt

taskwork.o:	system.equ

vmark.o:	\pic\etc\vmark.ton


sub.o:	rnd.dat

rnd.dat:	rnddat.exe
	echo ; Œ藐\(256byte)>$@
	$^ >>$@

rnddat.exe:	rnddat.c
	bcc $^

call2.o:	${BNS1}\bnserr.s

stginit.s:	${STG}\stginit.s
	copy $^ $@
